home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magnum One
/
Magnum One (Mid-American Digital) (Disc Manufacturing).iso
/
d12
/
cgazv5n5.arc
/
XMSHMA.C
< prev
next >
Wrap
C/C++ Source or Header
|
1991-09-23
|
1KB
|
49 lines
/*--- XMSHMA.C --------------------------- Listing 4 ------
* XMS HMA Functions. main() prints a greeting from HMA.
* by David Babcock
*
* Must be linked with XMSGEN (Listing 1)
*
* Validated for Microsoft and Borland C/C++
*
* (c) 1991 C Gazette. Object Code may be used freely,
* source code may be used if authorship and publication
* are acknowledged.
*-------------------------------------------------------*/
#include <stdio.h>
#include "xms.h"
static char hello[] = "Hello from the HMA" ;
static char hello_again [ 30 ] ;
void main ( void )
{
unsigned int ver ;
char far *HMAPtr, far *fp ;
char *np1, *np2 ;
int gotHMA ;
ver = ( unsigned int ) GetXMSVersionNumber();
printf ( "XMS version %s\n", PrintXMSVersionNumber ( ver ));
if ( ver >= 0x200 ) {
gotHMA = ( RequestHighMemoryArea ( 0xFFFF ) == 0 ) ;
if ( gotHMA ) {
HMAPtr = MK_FP ( 0xFFFF, 0x0010 ) ;
np1 = hello ;
np2 = hello_again ;
fp = HMAPtr ;
while (( *fp++ = *np1++ ) != 0 )
;
fp = HMAPtr ;
while (( *np2++ = *fp++ ) != 0 )
;
printf ( "%s", hello_again ) ;
ReleaseHighMemoryArea();
}
else
printf ( "Couldn't access the HMA.\n" );
}
}